var currentWin = Ti.UI.currentWindow;
/*
 * sets db version which is important for db changes. Also installs the local sqlite 
 * database. This query uses a simple select query to display all cats that have a status of 1.
 */
var dogsel = Ti.UI.currentWindow.DogName;
var dbversion = 1.4;
var db = Ti.Database.install('../paws.sqlite','dogs' + dbversion);
var rows = db.execute('SELECT description,largephoto,status from dogs where STATUS=1 AND name="' + dogsel + '"');


/*
 * Creates scrollview to add in ImageView and TextArea.
 * This shows each cat and the description.
 */
var imagepet = Ti.UI.createImageView({
	image:'' + rows.fieldByName('largephoto') + '',
	top:'10',
	hidden:false
	
});

var textarea = Ti.UI.createTextArea({
	backgroundColor:'#ddd',
	font:{fontSize:14},
	value:'' + rows.fieldByName('description') + ''
});
var scrollview = Titanium.UI.createScrollableView({
	views:[imagepet,textarea],
	showPagingControl:true,
	pagingControlHeight:30
	
});


scrollview.add(imagepet);
scrollview.add(textarea);
currentWin.add(scrollview);
